home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / gnuplot.lha / gnuplot / fitdemo / demo1 next >
Encoding:
Text File  |  1993-06-23  |  2.6 KB  |  65 lines

  1. pause -1 "first plotting the pure data set  (-> return)"
  2.  
  3. plot 'lcdemo.dat'
  4. set xlabel "Temperature T  [deg Cels.]"
  5. set ylabel "Density [g/cm3]"
  6.  
  7. pause 0 "now fitting a straight line to the data :-)"
  8. pause 0 "only as a demo without physical meaning"
  9. load 'line.fnc'
  10. y0 = 0.0
  11. m = 0.0
  12. show variables
  13. pause -1 "first a plot with all parameters set to zero  (-> return)"
  14. plot 'lcdemo.dat', l(x)
  15. pause -1 "now start fitting...  (-> return)"
  16. fit l(x) 'lcdemo.dat' via y0, m
  17. pause -1 "now look at the result (-> return)"
  18. plot 'lcdemo.dat', l(x)
  19.  
  20. pause -1 "see the influence of weights for single data points   (-> return)"
  21. fit l(x) 'lcdemo.dat' using 1:2:3 via y0, m
  22. pause -1 "now look at the result (-> return)"
  23. plot 'lcdemo.dat', l(x)
  24.  
  25. pause -1 "now prefer the high temperature data   (-> return)"
  26. fit l(x) 'lcdemo.dat' using 1:2:4 via y0, m
  27. pause -1 "now look at the result (-> return)"
  28. plot 'lcdemo.dat', l(x)
  29.  
  30. pause  0 "now use real single-measurement errors to reach such a result (-> return)"
  31. pause  0 "(look at the file lcdemo.dat and compare the columns to see the difference)"
  32. pause -1 "(-> return)"
  33. plot 'lcdemo.dat' using 1:2:5 with errorbars
  34. fit l(x) 'lcdemo.dat' using 1:2:5 via y0, m
  35. pause -1 "now look at the result (-> return)"
  36. plot 'lcdemo.dat' using 1:2:5 with errorbars, l(x)
  37.  
  38. pause 0 "It's time now to try a more realistic model function"
  39. load 'density.fnc'
  40. show functions
  41. pause 0 "density(x) is a function which shall fit the whole temperature"
  42. pause 0 "range using a ?: expression. It contains 6 model parameters which
  43. pause 0 "will all be varied. Now take the start parameters out of the"
  44. pause -1 "file 'start.par' and plot the function    (-> return)"
  45. load 'start.par'
  46. plot 'lcdemo.dat', density(x)
  47. fit density(x) 'lcdemo.dat' 'start.par'
  48. pause -1 "now look at the result (-> return)"
  49. plot 'lcdemo.dat', density(x)
  50.  
  51. pause 0  "looks already rather nice? We will do now the following: set"
  52. pause 0  "the epsilon limit higher so that we need more iteration steps"
  53. pause 0  "to convergence. During fitting please hit a key. You will be asked"
  54. pause 0  "Stop, Continue, Execute: Try everything. There is a script"
  55. pause 0  "defined which will plot the function with the actual parameter"
  56. pause -1  "set.     (-> return)"
  57. FIT_LIMIT = 1e-10
  58. fit density(x) 'lcdemo.dat' 'start.par'
  59. pause -1 "now look at the result (-> return)"
  60. plot 'lcdemo.dat', density(x)
  61. pause 0  "You can have a look at all previous fit results by looking into"
  62. pause 0  "the file 'fit.log' or whatever you defined the env-variable 'FIT_LOGFILE'."
  63. pause 0  "Remember that this file will always be appended, so remove it"
  64. pause 0  "from time to time!"
  65.